﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BesAsm.Emgaats.Core
{
  /// <summary>
  /// Exception to be thrown when an action is attempted on a model which does not have the required state
  /// </summary>
  public class ModelStateException : Exception
  {
    ModelState _currentState;
    ModelState _requiredState;

    /// <summary>
    /// Initializes a new instance of the <see cref="ModelStateException"/> class.
    /// </summary>
    /// <param name="actualState">The actual current state of the model.</param>
    /// <param name="requiredState">The state of the model required to perform the action that threw this exception</param>
    /// <param name="message">A message indicating the nature of the exception.</param>
    public ModelStateException(ModelState currentState, ModelState requiredState, string message)
      : base(message)
    {
      _currentState = currentState;
      _requiredState = requiredState;
    }

    /// <summary>
    /// Gets the current state of the model
    /// </summary>
    public ModelState CurrentState
    {
      get { return _currentState; }
    }

    /// <summary>
    /// Gets the required state of the model to perform the action which raised this exception
    /// </summary>
    /// <value>
    /// The required state of the model
    /// </value>
    public ModelState RequiredState
    {
      get { return _requiredState; }
    }



  }
}
